<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once './application/views/sys_admin/common/shop_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
		<div class="admin_right_title">
			<strong>商城管理</strong> &gt;&gt;  订单列表
		</div>
		<div class="admin_right_con" >
			<table border="0" cellspacing="1" cellpadding="0">
			  <tr style="color:#0068b7;">
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>订单编号</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>用户名</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>客服</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>商品编号</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>商品名称</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>数量</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>地址</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>单件积分</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>总积分</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>兑换时间</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>状态</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>是否前台显示</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>操作</strong></td>
			  </tr>
			  <?php foreach($list as $info){?>
			  <tr>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['username'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $kefu_list[$info['kefu_userid']]['username'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['pid'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['pname'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['pnum'];?></td>
				<td height="35" align="left" valign="middle" bgcolor="#FFFFFF"><?php echo "姓名：",$info['get_name'],"<br>地址：",$info['get_address'],"<br>电话：",$info['get_phone'],"<br>邮编：",$info['get_pc'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['price'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['total_price'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo date('Y-m-d H:i',$info['add_time']);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['fstatus']==1?"已发货":"<span style='color:red'>未发货</span>";?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF">
					<input type="checkbox" name="checkbox" <?php if($info['is_show'] == 1){?>checked="checked"<?php }?> value="<?php echo $info['id'];?>" onclick="is_show(this);">	
			  	</td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><a href="javascript:fahuo(<?php echo $info['id'];?>);">确认发货</a></td>
			  </tr>
			  <?php }?>
			  <tr>
			  	<td colspan="13"  height="35" align="right" valign="middle" bgcolor="#FFFFFF">
			  		<form id="searchForm" action="/sys_admin/shop/order/" method="get">
			  			用户名：<input type="text" id="username" name="username" style="width: 100px;" value="<?php echo $where['username'];?>" />
			  			商品ID：<input type="text" id="pid" name="pid" style="width: 100px;" value="<?php echo $where['pid'];?>" />
			  			状态：<select id="fstatus" name="fstatus">
			  				<option value="-1" <?php if($where['fstatus']==-1){?>selected="selected"<?php }?>>所有</option>
			  				<?php foreach($statusArr as $key=>$value){?>
			  				<option value="<?php echo $key?>" <?php if($where['fstatus']==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
			  				<?php }?>
			  			</select>
			  			下单时间：<input type="text" id="strtime" name="strtime" readonly="readonly" style="width: 100px;" value="<?php echo $where['strtime'];?>"  onfocus="WdatePicker()" />
			  			--<input type="text" id="endtime" name="endtime" readonly="readonly" style="width: 100px;" value="<?php echo $where['endtime'];?>"  onfocus="WdatePicker()" />
			  			<input type="submit" value="查询" /><a href="/sys_admin/shop/order_excel?username=<?php echo $where['username'];?>&pid=<?php echo $where['pid'];?>&fstatus=<?php echo $where['fstatus'];?>&strtime=<?php echo $where['strtime'];?>&endtime=<?php echo $where['endtime'];?>">导出数据</a>
			  		</form>
			  	</td>
			  </tr>
			  <tr>
			  	<td  height="35" colspan="13" align="center" class="page" bgcolor="#FFFFFF"><?php echo $this->pagination->create_links();?></td>
			  </tr>
			</table>
			
			</div>
	</div>
<!-- Admin_Right End -->
</div>
<form id="tmpform"></form>
<script>
function fahuo(id){
	$('#dialog').dialog({
		modal:true,
		title:'系统提示',
		buttons:{"确定":function(){
			var options = {
				url : '/sys_admin/shop/fahuo/'+id,
				dataType: "text",
				type:"get",
				success : function(msg) {
					$('#dialog').dialog({
						modal:true,
						title:'系统提示',
						buttons:{"确定":function(){$(this).dialog("close");}},
						close: function() {
							location.reload();
						}
					}); 
					$("#msg").html(msg);
				}
			};
			$('#tmpform').ajaxSubmit(options);
		},
		"取消":function(){$(this).dialog("close");}}
	}); 
	$("#msg").html("确认已经发货吗？");

}

function is_show(_this){
	var id = $(_this).val();

	var _show = 1;
	
	if($(_this).attr('checked') == true || $(_this).attr('checked') == 'checked'){
		_show = 0;
	}
	
	$.ajax({ 
		url: "/sys_admin/shop/order_show", 
		data: "id="+id+"&is_show="+_show,
		type:'POST',
		success: function(msg){
			
			
		}
	});	
	
}
</script>
<div id="dialog" title="系统提示" style="display:none;">
<div id="msg" style="text-align:center;color:red">&nbsp;</div>
</div>
<!-- admin_main end -->
</body>
</html>
